<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <div th:replace="~{common/base-css.html::htmlhead}"></div>
    <title>欢迎来到权限乐园</title>
    <style>
        .header {
            text-align: center;
        }

        .header h1 {
            font-size: 200%;
            color: #333;
            margin-top: 30px;
        }

        .header p {
            font-size: 14px;
        }
    </style>
</head>
<body>
<div class="am-g tpl-g">
    <div class="tpl-login">
        <div class="tpl-login-content">
            <div class="tpl-login-logo">
            </div>
            <form class="am-form tpl-form-line-form">
                <div class="am-form-group">
                    <input type="text" class="tpl-form-input" name="account" id="account" placeholder="请输入账号">
                </div>
                <div class="am-form-group">
                    <input type="password" class="tpl-form-input" name="password" id="password" placeholder="请输入密码">
                </div>
                <div class="am-form-group tpl-login-remember-me">
                    <input id="remember-me" type="checkbox">
                    <label for="remember-me">
                        记住密码
                    </label>
                </div>
                <div class="am-form-group">
                    <button type="button" class="am-btn am-btn-primary  am-btn-block tpl-btn-bg-color-success tpl-login-btn"
                            onclick="login()">
                        提交
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
<input type="hidden" id="kickOutSign" th:value="${kickOutSign}">
<div th:replace="~{common/base-js.html::javascriptHtml}"></div>
<script>
    if ($("#kickOutSign").val()) {
        Message.error("您的账号已在别处登陆,如不是本人操作,请及时修改密码!");
    }

    function login() {
        $.post(ctxPath + 'user/checkLogin', $('.am-form').serialize()).then(function (resp) {
            if (resp.success) {
                location.href = ctxPath + 'home';
            } else {
                Message.error(resp.message);
            }
        })
    }
    // 获取主题
    $(document).ready(function () {
        //获取护眼模式开关状态
        getThemeToggle();
    });

    $(function () {
        // 保证登陆页弹在最顶层
        if (window !== top) {
            top.location.href = location.href;
        }
    })

</script>
</body>
</html>